<?php
 
$cs = Yii::app ()->getClientScript ();
////$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/jpicker-1.1.6.min.js");
//$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/colorpicker.js");
//$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/eye.js");
//$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/utils.js");
//$cs->registerCssFile(Yii::app ()->request->baseUrl. "/css/colorpicker/colorpicker.css");
////jpicker-1.1.6.min.js
////$this->renderPartial('index',(array)$this);

$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/tiny_mce/jquery.tinymce.js");
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/tiny_mce/tiny_mce.js");
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/jquery.upload.js");
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/jquery-ui-1.8.7.custom.min.js");


$cs->registerCssFile(Yii::app ()->request->baseUrl. "/css/ajax_edit.css"); 

?> 
<h1><?php echo $this->id . '/' . $this->action->id; ?></h1>

<form method='post' action='<?php echo $this->createUrl('/picture/upload',array('filename'=>'abc'));?>' enctype="multipart/form-data">

<input type='file' name='abc'/>
<input type=submit value='ok'/>

	<form  id='test' action='<?php echo $this->createUrl('/picture/index',array('filename'=>'abc','type'=>1));?>' >
	
	
		<input type='file' id='test' name='abc'/>
		<input type='button' id='testbutton' value='abc'/>
		<input type='submit' id='button' value='submit'/>
		<img />
	</form>
</form>
 
<script type="text/javascript">

$('#testbutton').click(function(){
	  $('#test').upload('<?php echo $this->createUrl('/picture/upload',array()); ?>',
			  function(res) { alert(res);
				 alert(res.error.size);
				 $('#testbutton').next('img').attr('src'
						 ,'<?php echo $this->createUrl('/picture/thumbnail',array('pid'=>'/'));?>'+res.id);
	 
		});
});

</script>